<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src='https://unpkg.com/@antv/l7'></script>
    <script src="https://lib.baomitu.com/jquery/2.2.4/jquery.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0
        }

        #map {
            width: 100vw;
            height: 100vh;
        }

        html,
        body {
            overflow: hidden;
        }
    </style>
</head>

<body>
    <div id="map">

    </div>
    <script>
        var { Scene, GaodeMap } = L7;
        const scene = new Scene({
            id: 'map',
            map: new GaodeMap({
                /* dark|light|normal */
                style: 'normal', // 样式URL
                center: [120.19382669582967, 30.258134],
                pitch: 50,
                zoom: 2,
                // token: '3851594382e218c49865a4d6a5170b52',
            }),
            logoVisible: false
        });
        /*
        1、侧重地理数据的展示
        2、map是作为场景Scene的一个属性
        Scene场景  使用地图来实现地理数据的可视化
         */
        /* L7
        阿里
        高德 --阿里  国内
        国际 mapbox
         */
        var china_url = 'https://geo.datav.aliyun.com/areas_v3/bound/100000_full.json'
        /*
        PointLayer   image     circle
        LineLayer  stroke  line
        PolygonLayer  fill     fill
         */
        $.ajax({
            url: china_url
        }).then(data => {
            console.log(data)
            var china_layer = new L7.PolygonLayer();
            china_layer.source(data)
                .color("#ff2d51")
                /* 鼠标悬停,图层高亮 */
                // .active(true)
                // .active({
                //     color: "#333"
                // })
                .select(true)
            /* source  设置图层数据源
               color设置图层的颜色
             */
            scene.addLayer(china_layer)

            var line_layer = new L7.LineLayer();
            line_layer.source(data)
                .color("#333")
            scene.addLayer(line_layer)
            /* active  鼠标悬停
               select  点击事情
             */

        })
    </script>
</body>

</html>